//
//  ActeDaunaViewController.m
//  RCA24
//
//  Created by Raul Pacurar on 2/11/12.
//  Copyright (c) 2012 Comknow. All rights reserved.
//

#import "ActeDaunaViewController.h"

@implementation ActeDaunaViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    UIImage * backgroundPattern = [UIImage imageNamed:@"bg-app.png"];
    [self.view setBackgroundColor:[UIColor colorWithPatternImage:backgroundPattern]];
}

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

-(void)dealloc
{
    [tiriacButton release];
    [astraButton release];
    [asiromButton release];
    [detailsView release];
    [backButton release];
    [backButtonDetails release];
    [super dealloc];
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)showDetailsWindow
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    
    detailsView.transform = CGAffineTransformMakeTranslation(-320, 0);
    
    [UIView commitAnimations];

}
-(void)hideDetailsWindow
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.3];
    
    detailsView.transform = CGAffineTransformMakeTranslation(-0, 0);
    
    [UIView commitAnimations];

}

- (IBAction)buttonPressed:(id)sender
{
    if (sender == asiromButton || sender == tiriacButton || sender == astraButton)
    {
        [self showDetailsWindow];
    }
    else if (sender == backButton)
    {
        [self.navigationController popViewControllerAnimated:YES];
    }
    else if (sender == backButtonDetails)
    {
        [self hideDetailsWindow];
    }
        
    
}


@end
